package com.bwie.controller;

import com.bwie.pojo.GroupActive;
import com.bwie.service.GroupActiveService;
import com.bwie.service.impl.GroupActiveServiceImpl;
import com.bwie.utils.R;
import com.bwie.vo.PageInfoVo;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
 * 拼团活动表(tb_group_active)表控制层
 *
 * @author xxxxx
 */
@RestController
@RequestMapping("/team/team")
public class GroupActiveController {
    /**
     * 服务对象
     */
    @Autowired
    private GroupActiveService groupActiveService;

    /**
     * @author: 鑫仔
     * @description: 拼团活动表
     * @params: [com.bwie.vo.PageInfoVo]
     * @return: com.bwie.utils.R
     * @date: 2025/7/27 19:04
     */
    @PostMapping("/groupActiveList")
    public R groupActiveList(
            @RequestBody PageInfoVo pageInfoVo
    ) {
        return groupActiveService.groupActiveList(pageInfoVo);
    }

    /**
     * @author: 鑫仔
     * @description: 添加拼团活动
     * @params: [com.bwie.pojo.GroupActive]
     * @return: com.bwie.utils.R
     * @date: 2025/7/27 19:08
     */
    @PostMapping("addGroupActive")
    public R addGroupActive(
            @RequestBody GroupActive groupActive
    ) {
        return groupActiveService.addGroupActive(groupActive);
    }

    /**
     * @author: 鑫仔
     * @description: 删除拼团活动
     * @params: [com.bwie.pojo.GroupActive]
     * @return: com.bwie.utils.R
     * @date: 2025/7/27 19:08
     */
    @PostMapping("deleteGroupActive/{activeId}")
    public R deleteGroupActive(
            @PathVariable(name = "activeId") Integer activeId
    ) {
        return groupActiveService.deleteGroupActive(activeId);
    }

    /**
     * @author: 鑫仔
     * @description: 修改活动
     * @params: [com.bwie.pojo.GroupActive]
     * @return: com.bwie.utils.R
     * @date: 2025/7/27 19:57
     */
    @PostMapping("updateGroupActive")
    public R updateGroupActive(
            @RequestBody GroupActive groupActive
    ){
        return groupActiveService.updateGroupActive(groupActive);
    }


}
